//
//  GDFoodModel.m
//  美团试验 (自己)
//
//  Created by 热带雨林 on 17/2/12.
//  Copyright © 2017年 热带雨林. All rights reserved.
//

#import "GDFoodModel.h"
#import "GDDetailsFoodModel.h"
#import "CZAdditions.h"

@implementation GDFoodModel
- (void)setValue:(id)value forKey:(NSString *)key{
    //先获得value转换成数组
    [super setValue:value forKey:key];
    if([key isEqualToString:@"spus"]){
    
        NSArray *array = (NSArray *)value;
        NSMutableArray <GDDetailsFoodModel *>*arrayM = [NSMutableArray array];
        [array enumerateObjectsUsingBlock:^(NSDictionary  *dic, NSUInteger idx, BOOL * _Nonnull stop) {
            GDDetailsFoodModel *model = [GDDetailsFoodModel cz_objectWithDict:dic];
            [arrayM addObject:model];
        }];
        
        //覆盖掉原来的数据
        [super setValue:arrayM forKey:key];
    }
}
//防崩
- (void)setValue:(id)value forUndefinedKey:(NSString *)key
{


}

@end
